Edge detecting method

ABSTRACT

There is provided an edge detecting method, which is capable of preventing a noise influence caused by imaging device and a color interpolation. The edge detecting method includes the steps of: setting a first kernel based on a center pixel in pixel data arranged in a mosaic structure; setting a second kernel based on the center pixel within the first kernel; detecting whether a pixel having a green value in the second kernel is a defective pixel, and correcting the pixel; converting all pixels of the second kernel into pixels having green value; calculating a slope value by using a mask for detecting an edge in the second kernel; and detecting an edge by adding the slope value to a luminance value obtained by a color space conversion.

FIELD OF THE INVENTION

The present invention relates to a method for processing an imagesignal; and, more particularly, to a method for detecting an edge of animage signal.

DESCRIPTION OF RELATED ART

An image sensor can be used in various fields, such as a cell phone, apersonal computer (PC) camera, a medical science, a toy, and so on. Thatis, the image sensor is widely used in all fields where an image signalis used.

Such an image sensor captures an image of an object and the capturedimage is displayed on a screen. A picture quality of the displayed imageis largely determined depending on a sharpness of an edge. Accordingly,various correction methods for improving the sharpness of the edge ofthe image have been proposed.

FIG. 1 is a schematic block diagram of a conventional image sensor.

Referring to FIG. 1, the conventional image sensor includes a controland external system interface 11, a pixel array 10, an analog-to-digitalconverter (hereinafter, referred to as an ADC) 12, a line memory 13, andan image signal processor 14.

The pixel array 10 includes pixels arranged in an N×M matrix and detectsan image information. The control and external system interface 11controls an overall operation of the image sensor by using a finitestate machine (FSM), and manages an interface operation for an externalsystem. The control and external system interface 11 includes a batchregister (not shown) so that several internal operations can beprogrammed. Also, the control and external system interface 11 controlsan operation of the entire chip according to the programmed information.

Although not shown in FIG. 1, an analog line buffer detects and storesvoltages of selected pixels of one row. A data value of a columnselected by a column decoder is transferred to a variable amplifierthrough an analog bus.

If a pixel voltage stored in the analog line buffer is small, thevariable amplifier, for example a programmable gain amplifier (PGA),amplifies the pixel voltage. A color correction is performed on theanalog data passing through the variable amplifier. Then, the ADC 12converts the analog data into a digital value.

The line memory stores the digitalized RGB image signals based on thelines. The image signal processor 14 performs an error correction, acolor interpolation, a gamma correction, a color space conversion, andso on.

Meanwhile, a fixed pattern noise occurs in the image sensor due to anoffset voltage, which is caused by a minute difference in themanufacturing process. In order to compensate for the fixed patternnoise, the image sensor employs a correlated double sampling(hereinafter, referred to as a CDS), which reads reset voltage signalsand data voltage signals from the pixels of the pixel array 11 10 andoutputs a difference therebetween.

As described above, the image signal processor 14 performs a colorinterpolation, a color space conversion, a gamma correction, and an edgedetection and enhancement.

According to a conventional edge detecting and correcting method, acolor space conversion is performed to convert an RGB Bayer pattern intoan YcbCr pattern space. Among them, a brightness signal Y is used todetect an edge.

The edge detection will now be described briefly.

The brightness signal is stored in the line buffer and is inputted to afirst-order differentiator. The first-order differentiatordifferentiates an image signal to obtain a strength and a direction.Then, the brightness signal is inputted to a second-orderdifferentiator. The second-order differentiator performs thedifferential to extract an edge of an inputted image signal. At thispoint, the second-order differentiator obtains only a strength of anedge. The edge extracted by the second-order differentiator forms aclosed curve. The extracted edge is transferred to a multiplier. Themultiplier multiplies the inputted edge by a preset gain so as toenhance a sharpness of the extracted edge. The information on the edgemultiplied by the gain is transferred to a Coring.

The Coring prevents an amplification of noise existing in a lowfrequency band. That is, the information on the edge having a lowerfrequency band than a predetermined value is converted into zero. Theconverted edge information is then transferred to an adder.

The adder adds the converted edge information transferred from theCoring to the inputted image signal and transfers the result to aclipping circuit. The clipping circuit limits the inputted image withina range of 0-255 in its brightness level. The clipped image signal isoutputted as an image signal whose edge is enhanced in the sharpness.

However, the conventional edge detecting and correcting method does notconsider a noise caused by a detective pixel or the imaging devices (thepixel array 10, the ADC 12 and the line memory 13). Therefore, anunintended edge may be detected.

In addition, since the edge is detected using the brightness signalafter the color interpolation, the image signal is affected by noisecaused in the color interpolation. Due to this, there is a problem inthat a false color caused by the color interpolation is more distinct.

SUMMARY OF THE INVENTION

It is, therefore, an object of the present invention to provide an edgedetecting method, which is capable of preventing a noise influencecaused by imaging device and a color interpolation and also detectingthe edge can be detected without a line memory.

In an aspect of the present invention, there is provided an edgedetecting method, including the steps of: setting a first kernel basedon a center pixel in pixel data arranged in a mosaic structure; settinga second kernel based on the center pixel within the first kernel;detecting whether a pixel having a green value in the second kernel is adefective pixel, and correcting the pixel; converting all pixels of thesecond kernel into pixels having green value; calculating a slope valueby using a mask for detecting an edge in the second kernel; anddetecting an edge by adding the slope value to a luminance valueobtained by a color space conversion.

The present invention can detect an edge by using the RGB Bayer signalprior to the color interpolation, without using the brightness signal(Y). Thus, the image is not affected by the noise occurring in the colorinterpolation. Also, in the edge detection, the noise caused by thedetective pixel or the previous-stage imaging devices can becompensated, so that the edge is detected more correctly.

BRIEF DESCRIPTION OF THE DRAWINGS

The above and other objects and features of the instant invention willbecome apparent from the following description of preferred embodimentstaken in conjunction with the accompanying drawings, in which:

FIG. 1 is a schematic block diagram of a conventional image sensor;

FIG. 2 is a flowchart illustrating an edge detecting method inaccordance with an embodiment of the present invention;

FIGS. 3A and 3B are flowchart illustrating the step S204 of FIG. 2;

FIG. 4 is an exemplary diagram of a case where G luminance values of Rand B pixels are interpolated using G pixels in 5×5 kernel by a medianfilter; and

FIG. 5 is another exemplary diagram of a case where G luminance valuesof R and B pixels are interpolated using an average value.

DETAILED DESCRIPTION OF THE INVENTION

Hereinafter, the present invention will be described in detail withreference to the accompanying drawings.

FIG. 2 is a flowchart illustrating an edge detecting method inaccordance with an embodiment of the present invention.

Referring to FIG. 2, in step S201, a first kernel (for example, a 5×5kernel) is set based on a center pixel in pixel data of a mosaicarrangement so as to detect an edge. This process is aimed tointerpolate a G value because the respective pixels have a luminancevalue only in one specific color in a color filter array (hereinafter,referred to as a CFA).

In step S202, a second kernel (for example, a 3×3 kernel) is set withinthe first kernel, based on the center pixel. In step S203, G values ofall pixels in the second kernel are interpolated using the G pixel(pixel having a luminance value in a green component) of the firstkernel. In this manner, the G value is interpolated and the edge isdetected using the interpolated G value. That is, in step S205, allpixels of the second kernel have the G value.

Meanwhile, in step S203, before all pixels of the second kernel have theG value, it is checked whether or not all pixels of the second kernelhave the G value.

In step S204, it is checked whether the pixel having the G value is adefective pixel or a noise, and then its luminance value is corrected.In step S206, it is checked whether there is the pixel having no Gvalue. If so, the process returns to the step S203.

In step S207, if all pixels have the G value, a slope value iscalculated using several masks for the edge detection in the secondkernel. At this point, a Laplacian filter is used.

In step S208, the slope value is added to a luminance value obtained bya color space conversion.

In step S209, a Coring and a clipping are performed to prevent a noiseamplification and an overflow of an image signal. In step S210, a newsecond kernel is set and the above processes are repeated.

FIGS. 3A and 3B are flowcharts of the step S204 in FIG. 2.

In step S301, a second kernel for correcting a distorted luminance valueis set. This step of setting the second kernel is the same as the stepS202 of FIG. 2.

In step S302, threshold values Th1 and Th2 are set and all counters areinitialized so as to determine whether or not a center pixel having a Gvalue (a luminance value of the center pixel) in the second kernel isdistorted.

In step S303, the luminance value of the center pixel is compared withthe threshold value Th2. If the luminance value of the center pixel islarger than the threshold value Th2, the process proceeds to step S305.In step S304, if the luminance value of the center pixel is smaller thanthe threshold value Th2, the threshold value Th1 is again set. That is,the threshold value Th1 is adjusted according to a luminance value of acurrent pixel. It is because noise cannot be correctly found when thesame threshold value is applied regardless of the luminance values ofthe pixels.

In step S305, if the threshold value Th1 is determined, a difference Δin the luminance values of the center pixel and the pixel of the secondkernel (an adjacent pixel having the same color characteristic) iscalculated. In step S307, if the Δ value is larger than the thresholdvalue Th1, a value count1 representing the number of the adjacent pixelswhose luminance value is larger than the threshold value increases. Instep S308, if the Δ value is smaller than the threshold value Th1, avalue count2 representing the number of the pixels whose colorcharacteristic is equal to that of the center pixel increases. In stepsS310 and S311, if the value count1 is zero, it is considered that thereis no noise and Edge(i, j) is set to zero. Then, in step S318, a nextkernel is set.

Here, the value count2 is used to count the number of the adjacentpixels arranged in vertical or horizontal positions with respect to theG pixel (pixel having the luminance value of the G value) to becurrently interpolated. The pixel to be interpolated and the adjacentpixels are the pixels contained in the second kernel.

If the value count1 is not zero, the following processes will beperformed.

It is assumed that the current center pixel is disposed at an i-th rowand a j-th column. In step S312, it is checked whether or not the valuecount1 and the value count2 are equal to each other and whetherdifferences in the luminance values of the center pixel and the pixelshaving the same G value are equal to each other.

Here, the row corresponds to a height of the image and the columncorresponds to a width of the image. In steps S313 to S316, if thevalues count1 and count2 are equal to each other and signs of the Δvalues for all the adjacent pixels are equal to each other, a weightvalue is multiplied according to a single (edge) representing whetherthe pixel luminance value of a (i−1)-th row.

In other words, Edge(i−1, j−1), Edge(i−1, j) and Edge(i−1, j+1)represent whether pixel values of (j−1)-th, j-th and (j+1)-th columnsare abnormal (that is, extremely large or 5 extremely small). If thereis the abnormal value among them and a pixel value of the current i-throw and j-th column is abnormal, the corresponding pixel is consideredas an edge and thus is not corrected. If there is no abnormal value inthe previous row and the pixel value of the current row is abnormal, thecorresponding pixel is considered as a noise and thus is corrected.Also, the reason why the weight value of the distorted signal isdifferent is that a white defect must be corrected with a little largevalue and a dark defect must be corrected with a little small value.

In step S317, if the two count values is not equal to each other and thesigns of the Δ values are not equal to each other, Edge(i, j) becomes 1and a next kernel is set.

FIG. 4 is an exemplary diagram of a case where G luminance values of Rand B pixels are interpolated using G pixels in 5×5 kernel by a medianfilter. Here, the R and B pixels represent pixels having luminancevalues in R and B color components, and the G pixel is a pixel havingluminance value in G color component.

In FIG. 4, a G luminance value of a pixel R23 is interpolated in aGb-type kernel.

In order to calculate a G luminance value ExG12 of the pixel R23 in theGb-type kernel, luminance values of the adjacent G pixels are required.That is, ExG12 is used as the G luminance value of the pixel R23. Here,the ExG12 is a median output of the luminance values of the four pixelsG13, G22, G24 and G33. The median output is obtained by selecting twosmall luminance values and averaging them. Likewise, the G luminancevalues E×G21, E×G23 and E×G32 of the pixels B32, B34 and R43 arecalculated in the same manner.

Also, in FIG. 4, G luminance values of pixels R22, R24, B33, R42 and R44are interpolated in a B-type kernel.

FIG. 5 is another exemplary diagram of a case where G luminance valuesof R and B pixels are interpolated using an average value.

In order to interpolate the G luminance value of the pixel R23 in theGb-type kernel, a difference VDiff1 in luminance values of pixels G13and G33, a difference VDiff2 in luminance values of pixels G13 and R23,a difference VDiff3 in luminance values of pixels G33 and R23, adifference HDiff1 in luminance values of pixels G22 and G24, adifference HDiff2 in luminance values of pixels G22 and R23, and adifference HDiff3 in luminance values of pixels G24 and R23 arecalculated. Then, a sum VDiff of the difference values in a verticaldirection and a sum HDiff of the difference values in a horizontaldirection are calculated and then their absolute values are calculatedas follows:AbsVDiff=abs(VDiff1+VDiff2+VDiff3)AbsHDiff=abs(HDiff1+HDiff2+HDiff3)

The two absolute values AbsVDiff and AbsHDiff are compared with eachother. If the value AbsVDiff is larger than the value AbsHDiff, a valueof (G22+G24) is used as the G luminance value of the pixel R23. If thevalue AbsVDiff is smaller than the value AbsHDiff, a value of (G13+G33)is used as the G luminance value of the pixel R23.

As described above, the present invention can detect an edge by usingthe RGB Bayer signal prior to the color interpolation, without using thebrightness signal (Y). Thus, the image is not affected by the noiseoccurring in the color interpolation. Also, in the edge detection, thenoise caused by the detective pixel or the previous-stage imagingdevices can be compensated, so that the edge is detected more correctly.

In addition, the edge detection algorithm and the color interpolationcan be achieved at the same time.

The present application contains subject matter related to Korean patentapplication No. 2004-31989, filed in the Korean Patent Office on May 6,2004, the entire contents of which being incorporated herein byreference.

While the present invention has been described with respect to theparticular embodiments, it will be apparent to those skilled in the artthat various changes and modifications may be made without departingfrom the spirit and scope of the invention as defined in the followingclaims.

What is claimed is:
 1. An edge detecting method comprising the steps of:a) setting a first kernel based on a center pixel in pixel data arrangedin a mosaic structure; b) setting a second kernel based on the centerpixel within the first kernel; c) detecting whether a pixel having agreen value in the second kernel is a defective pixel, and, ifdefective, correcting the pixel; d) converting all pixels of the secondkernel into pixels having green value values; e) calculating a slopevalue by using a mask for detecting an edge in the second kernel; and f)detecting an edge by adding the slope value to a luminance valueobtained by a color space conversion.
 2. The edge detecting method asrecited in claim 1, wherein the first kernel is a 5×5 kernel and thesecond kernel is a 3×3 kernel.
 3. The edge detecting method as recitedin claim 1, further comprising the step of: prior to the step d),determining whether all pixels of the second kernel have the G valuegreen values.
 4. The edge detecting method as recited in claim 3,further comprising the steps of: checking whether the pixel having the Gvalue among the pixels a pixel of the second kernel having the greenvalues is a defective pixel or a noise; and correcting a luminance valueof the corresponding a defective or noise pixel.
 5. The edge detectingmethod as recited in claim 4, wherein the step of correcting theluminance value of the corresponding defective or noise pixel includesthe steps of: setting first and second threshold values according to aluminance value of the center pixel so as to determine whether thecenter pixel having the G green value in the second kernel is distortedor not; calculating a difference in luminance values of the center pixeland a pixel having the same G green value; comparing the difference withthe first threshold value; if the difference is smaller than the firstthreshold value, increasing a count value representing the number ofpixels having the same color characteristic as the center pixel;determining whether there exists a pixel having the same colorcharacteristic in a position adjacent to the center pixel; if there isno pixel having the same color characteristic, determining whether acount value representing the number of adjacent pixels whose differencein the luminance value from the center pixel is larger than the firstthreshold value is zero; and if the count value is zero, making an edgezero and setting a next 3×3 kernel.
 6. The edge detecting method asrecited in claim 5, further comprising the steps of: if the differencein the luminance value is larger than the first threshold value,increasing the count value representing the number of adjacent pixelswhose difference in the luminance value from the center pixel is largerthan the first threshold value.
 7. The edge detecting method as recitedin claim 5, further comprising the steps of: if the count valuerepresenting the number of the adjacent pixels whose difference in theluminance value from the center pixel is larger than the first thresholdvalue is not zero, determining whether the count number valuerepresenting the number of the adjacent pixels larger than the firstthreshold value is equal to the count value representing the number ofthe pixel having the same color characteristic as the center pixel andwhether the differences in the luminance values of the center pixel andthe pixel having the same G green value; and if the condition issatisfied, multiplying a weight value by the luminance value of thecenter pixel according to the distortion of using distorted luminancevalues of derived from pixels arranged in a previous row.
 8. The edgedetecting method as recited in claim 7, further comprising the step of:if the condition is not satisfied, setting the edge to 1 and setting anext second kernel.
 9. The edge detecting method as recited in claim 1,wherein the slope value is calculated using a Laplacian filter.
 10. Theedge detecting method as recited in claim 1, wherein a median filter oran average value is used in the step d).
 11. A method for operating animage sensor comprising: setting a first kernel about a target pixel ofan image; setting a second kernel within the first kernel, wherein thesecond kernel is configured about the target pixel; determining whetherthe target pixel is a green pixel; correcting the target pixel if it isgreen and defective; interpolating an effective green value for allnon-green pixels of the second kernel using green values of green pixelsadjacent each respective non-green pixel; and using the green values andthe effective green values of the second kernel to detect an edge of theimage.
 12. The method of claim 11, wherein the first kernel isconfigured so that the target pixel is centrally disposed within thefirst kernel.
 13. The method of claim 11, wherein the second kernel isconfigured so that the target pixel is centrally disposed within thesecond kernel.
 14. The method of claim 11, wherein said correcting thetarget pixel comprises correcting the target pixel if it is green anddefective or green and noise.
 15. The method of claim 11, wherein saidstep of using the green values and the effective green values of thesecond kernel to detect the edge of the image comprises calculating aslope value using a mask for detecting an edge in the second kernelusing the green values and the effective green values of the secondkernel.
 16. The method of claim 15, wherein the step of using the greenvalues and effective green values of the second kernel to detect theedge of the image comprises detecting the edge by adding the slope valueto a luminance value obtained by a color space conversion operation. 17.A method comprising: setting a first kernel and a second kernel, whereina green pixel is located in the first and second kernels, and whereinthe second kernel is configured within the first kernel; setting firstand second threshold values based on a luminance value of the greenpixel; determining whether the luminance value of the green pixelexceeds the second threshold value; adjusting the first threshold valueif the luminance value of the green pixel does not exceed the secondthreshold value; determining a first luminance difference value betweenthe green pixel and one or more green pixels of the second kernel;increasing a first count value if the first luminance difference isgreater than the first threshold value; increasing a second count value;and using the first count value and the second count value to determinewhether the green pixel needs correction.
 18. The method of claim 17,wherein the first kernel is configured so that the target pixel iscentrally disposed within the first kernel.
 19. The method of claim 17,wherein the second kernel is configured so that the target pixel iscentrally disposed within the second kernel.
 20. The method of claim 17,further comprising: correcting the target pixel if it is green and needscorrection; interpolating an effective green value for all non-greenpixels of the second kernel using green values of green pixels adjacenteach respective non-green pixel; and using the green values and theeffective green values of the second kernel to detect the edge of animage.